//创建线程，匿名内部类的写法
public class Demo3 {
    public static void main(String[] args) {
        //这里的t并不指向父类，指向的是一个匿名的子类
        Thread t = new Thread(){
            public void run(){
                while (true){
                    System.out.println("hello Thread");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        };

        t.start();
        while (true){
        System.out.println("hello world");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
